package lihao2;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Test6 {
    public static void main(String[] args) {

        List<Integer> integers = new ArrayList<>();
        integers.add(12);
        integers.add(13);
        integers.add(15);
        System.out.println("integers:" + integers);

        Integer i = integers.get(1);
        Integer i1 = integers.get(2);
        integers.set(1,i1);
        integers.set(2,i);
        System.out.println("互换后：" + integers);

        Collections.sort(integers);
        System.out.println("最大值：" + integers.get(integers.size()-1));
        System.out.println("最小值：" + integers.get(0));

        integers.forEach(o -> System.out.print(o + " "));

    }
}
